public class HybridConverter implements Converter {
    private final Runtime runtime = Runtime.getRuntime();
    
    @Override
    public void convert(File source, File target, ConversionConfig config) throws ConversionException {
        // 首先尝试使用Java库
        try {
            convertUsingJavaLibs(source, target, config);
        } catch (UnsupportedOperationException e) {
            // 如果Java库不支持，尝试使用外部命令
            convertUsingExternalTools(source, target, config);
        }
    }
    
    private void convertUsingExternalTools(File source, File target, ConversionConfig config) {
        try {
            // 例如使用LibreOffice转换
            String command = String.format(
                "soffice --headless --convert-to %s %s --outdir %s",
                target.getName().substring(target.getName().lastIndexOf('.') + 1),
                source.getAbsolutePath(),
                target.getParent()
            );
            Process process = runtime.exec(command);
            // 处理转换结果...
        } catch (IOException e) {
            throw new FileOperationException("外部转换失败", e);
        }
    }
} 